# _*_ coding:utf-8 _*_
# @author : Joyamon
# @time : 2022-12-12 19:07
# @file : send_file.py
from settings import ALLOWED_EXTENSIONS


def send(path):  # 发送大文件
    with open(path, 'rb') as f:
        while 1:
            data = f.read(20 * 1024 * 1024)
            if not data:
                break
            yield data


def allowed_file(filename):
    return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS